﻿using DataSync.Application.DataSync.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataSync.Application.DataSync
{
    /// <summary>
    /// 数据同步服务
    /// </summary>
    public class DataSyncService : IDynamicApiController
    {
        private readonly IDataSyncData _dataSync;
        public DataSyncService(IDataSyncData dataSync)
        {
            _dataSync = dataSync;
        }
        /// <summary>
        /// 客户端同步
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public string SyncDataForClient()
        {
            return _dataSync.SyncDataForClient(App.GetConfig<string>("ClientconnStr"), App.GetConfig<string>("ServiceconnStr"));
        }
        /// <summary>
        /// 服务端同步
        /// </summary>
        /// <returns></returns>
    
        [HttpPost]
        public string SyncDataForServer()
        {
            return _dataSync.SyncDataForServer(App.GetConfig<string>("ServiceconnStr"), App.GetConfig<string>("ClientconnStr"));
        }
    }

}
